package model

import (
	"gorm.io/gorm"
	"time"
)

type Upload struct {
	Id        uint32         `gorm:"column:id;type:int UNSIGNED;comment:文件ID;primaryKey;not null;"  form:"id" json:"id"` // 文件ID
	Name      string         `gorm:"column:name;type:varchar(255);comment:原始文件名;not null;"  form:"name" json:"name"`     // 原始文件名
	Url       string         `gorm:"column:url;type:varchar(255);comment:储存地址;not null;"  form:"url" json:"url"`         // 储存地址
	Size      float64        `gorm:"column:size;type:double;comment:文件大小;not null;"  form:"size" json:"size"`            // 文件大小
	UserId    int32          `gorm:"column:user_id;type:int;comment:上传时间;not null;"  form:"user_id" json:"user_id"`      // 上传时间
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);"  form:"created_at" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);"  form:"updated_at" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;"  form:"deleted_at" json:"deleted_at"`
}

func (u Upload) TableName() string {
	return "upload"
}
